gusucode.com > VC++ 汽配销售管理系统(Access)源码程序 > VC++ 汽配销售管理系统(Access)源码程序/源码/NumberEdit.cpp
//Download by http://www.NewXing.com // NumberEdit.cpp : implementation file // #include "stdafx.h" #include "qpglxt.h" #include "NumberEdit.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CNumberEdit CNumberEdit::CNumberEdit() { } CNumberEdit::~CNumberEdit() { } BEGIN_MESSAGE_MAP(CNumberEdit, CEdit) //{{AFX_MSG_MAP(CNumberEdit) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNumberEdit message handlers BOOL CNumberEdit::PreTranslateMessage(MSG* pMsg) { //如果输入的字符不是1~9或“.”或其它功能键 if(pMsg->message==WM_KEYDOWN ) { if((pMsg->wParam<0x30 || pMsg->wParam>0x39) && pMsg->wParam!=190 && pMsg->wParam!=8 && pMsg->wParam!=13) if(pMsg->wParam<VK_NUMPAD0 || pMsg->wParam>VK_NUMPAD9)// &&&& pMsg->wParam!=VK_PERIOD pMsg->wParam=VK_CONTROL; if( pMsg->wParam==13) pMsg->wParam=9; } return CEdit::PreTranslateMessage(pMsg); }